<?php
// 应用公共文件
function show($status, $message = 'error', $data = [], $httpStatus = 200) {
    $result = [
        'status' => $status,
        'message' => $message,
        'result' => $data,
    ];
    return json($result, $httpStatus);
}

function std_class_object_to_array($stdclassobject) {
    $_array = is_object($stdclassobject) ? get_object_vars($stdclassobject) : $stdclassobject;
    $array = [];
    foreach ($_array as $key => $value) {
        $value = (is_array($value) || is_object($value)) ? std_class_object_to_array($value) : $value;
        $array[$key] = $value;
    }
    return $array;
}

function stdClassToArray($object) {
    $object = json_decode(json_encode($object), true);
    return $object;
}